{block name="title"}<title>发表</title>{/block}
{block name="top"}<link rel="stylesheet" href="__CSS__/diwu.css"> {/block}
{extend	name="index"	/}
{block name="right"}
        <div class="mid">
            <div class="mid_top">
                <ul>
                    <li><a href="">OPPO社区</a></li>
                    <li><span>发表</span></li>
                </ul>
            </div>
            <div class="mid_left">
                <ul>
                    <form action="{:Url('home/diwu/fabu')}" method="post" enctype="multipart/form-data">
                        <span style="margin:10px 0px 0px 50px">标题</span><input type="text" name="title" style="width:400px;height:30px;margin:10px 10px 10px 30px"><br>
                        <span style="margin:10px 0px 0px 50px">作者</span><input type="author" name="author" style="width:400px;height:30px;margin:10px 10px 10px 30px"><br>
                        <span style="margin:10px 0px 0px 50px">选择话题</span><select name="topic" style="height:30px;margin:10px 10px 10px 30px">
                            <option value="0">拍客</option>
                            <option value="1">话题</option>
                            <option value="2">活动</option>
                            <option value="3">热帖</option>
                        </select><br>
                        <span style="margin:10px 0px 0px 50px">主题图片</span>
                        <input type="file" name="img" onchange="upImg(this)" style="width:50px;height:30px;margin:10px 10px 10px 30px">
                        <!-- <button style="width:80px;height:30px;background:green;margin-left:-70px;color:white">图片上传</button> -->
                        <span class="img_show" ></span>
                        <!-- 加载编辑器的容器 -->
                        <textarea id="container" name="content" type="text/plain" style="width:800px;height:600px;">
                            
                        </textarea>
                        <!-- 配置文件 -->
                        <script type="text/javascript" src="__STATIC__/UEditor/ueditor.config.js"></script>
                        <!-- 编辑器源码文件 -->
                        <script type="text/javascript" src="__STATIC__/UEditor/ueditor.all.js"></script>
                        <!-- 实例化编辑器 -->
                        <script type="text/javascript">
                            var ue = UE.getEditor('container');
                        </script>
                        <input type="submit" onclick="up" value="发布">
                    </form>
                </ul>
                <script>
                    function upImg(obj)
                        {
                        if( obj.value == "" ) {
                            return;
                        }
                        var formdata = new FormData(); 
                        //<input type="file" name="img" />
                        formdata.append("img" , $(obj)[0].files[0]);//获取文件法二
                        $.ajax({
                            type : 'post',
                            url : "{:Url('home/diwu/upload')}",
                            data : formdata,
                            cache : false,
                            processData : false, // 不处理发送的数据，因为data值是Formdata对象，不需要对数据做处理
                            contentType : false, // 不设置Content-type请求头
                            success : function(ret){
                                var html='<span class="img_html">'
                                    html+='<img src="'+ret+'" alt="" width="100px" height="100px">'
                                    html+='<span onclick="delImg(this)" class="img_del">删除</span>'
                                    html+='<input type="hidden" name="img[]" style="width:100px;" value="'+ret+'">'
                                    html+='</span>'
                                $('.img_show').append(html);
                            },
                            error : function(){ }
                        });

                    }
                    function delImg(obj){
                        $(obj).parent().remove()
                    }
                    function up(){
                        $.ajax({
                            url:"{:Url('home/diwu/fabu')}",
                            data:{title:$('.title').html(),author:$('.author').html(),topic:$('.topic').html(),content:$('.content').html(),},
                            dataType:'html',
                            type:'post',
                            success:function(data){
                            //    $('.bg').fadeOut('slow')
                            },
                        })
                    }
                </script>
                
                <!-- <div class="leftend"><a>没有数据</a></div> -->
            </div>
            <div class="mid_right1">
                <img src="__IMG__/15.png">
                <a href="">发表帖子</a>
            </div>
            <div class="mid_right1">
                <img src="__IMG__/16.png">
                <a href="">签到</a>
                <p>签到3021人</p>
            </div>
            <div class="mid_right2">
                <p><a>热门标签</a></p>
                <span>
                    <ul>
                        <li><a href="">R11</a></li>
                        <li><a href="">R9s</a></li>
                        <li><a href="">R9</a></li>
                    </ul>
                </span>
            </div>
            <div class="mid_right5">
                <img src="__IMG__/22.png">
                <p>OPPO社区APP</p>
                <a href="">下载到电脑</a>
            </div>
            <div class="mid_right3">
                <span><a>关注我们</a></span>
                <div class="mid_right4">
                    <img src="__IMG__/17.png">
                    <a href=""><img src="__IMG__/20.png">官方微博</a>
                </div>
                <div class="mid_right4">
                    <img src="__IMG__/19.png">
                    <a href=""><img src="__IMG__/21.png">官方微信</a>
                    <p>扫一扫</p>
                </div>
            </div>
        </div>
        {/block}